package com.oweight.sagacious.auth.server.interfaces.controller;

import com.oweight.sagacious.auth.server.application.IClientApplication;
import com.oweight.sagacious.auth.server.domain.entity.Client;
import com.oweight.sagacious.api.model.msg.Message;
import com.oweight.sagacious.common.interfaces.controller.BaseController;
import org.springframework.web.bind.annotation.*;

/**
 * @author 周广明
 * @version v1 2019/10/21 16:56
 */
@RestController
@RequestMapping("service")
public class ServiceController extends BaseController<Client, IClientApplication> {

    @RequestMapping(value = "/{id}/client", method = RequestMethod.PUT)
    public Message modifyUsers(@PathVariable int id, String clients) {
        getApplication().modifyClientServices(id, clients);
        return getMessage().rel();
    }

    @RequestMapping(value = "/{id}/client", method = RequestMethod.GET)
    public Message getUsers(@PathVariable int id) {
        return getMessage().rel().data(getApplication().getClientServices(id));
    }
}
